#include<bits/stdc++.h>
using namespace std;
#define lsb(x) (x&-x)
int u,v;
bool solve() {
  if(u>v)return false;
  if(u==v)return true;
  bool can = true;
  while(v>0) {
    int lsbu=lsb(u), lsbv=lsb(v);
    if(lsbv<lsbu || u==0) {
      return can=false;
    }
    u -= lsbu, v -= lsbv;
  }
  return can;
}
int main() {
  #ifndef ONLINE_JUDGE
  freopen("in.txt", "r", stdin);
  #endif
  int tc; cin>>tc;
  while(tc--) {
    cin>>u>>v;
    cout<<(solve()?"YES\n":"NO\n");
  }
}